﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enter.Mvc.Base.Controllers;
using Enter.Services.DataCache;
using Enter.Services.Mail;
using System.Web.Mvc;
using Enter.Mvc.Mall.Model.User;
using Enter.Entity;

namespace Enter.Mvc.Mall.Controllers
{
    public class MemberController : BaseControllers
    {
          private readonly ICache icache;
        private readonly IMail imail;

        public MemberController(ICache cache, IMail mail)
        {
            this.icache = cache;
            this.imail = mail;
            T201_UserEntity UserLogin = imail.GetUserByName("tongli");

            UserInfo user = new UserInfo();
            user.UserID = UserLogin.UIID;
            user.UserName = UserLogin.UName;
            user.ShopNo = UserLogin.ShopNo;
            user.UserType = (UserInfo.EnumUserType)(int)UserLogin.UserType;
            UserInfo.CurrentUser = user;
        }
     
        public RedirectResult CheckUser()
        {
            if (!UserInfo.isLogin)
            {
                return Redirect("/User/LogOn");
            }
            return null;
        }

        public ActionResult Index()
        {
            CheckUser();

            return View();

        }
        public ActionResult TopNav(int pageType)
        {
            ViewData["pageType"] = pageType;
            return PartialView();
        }
        public ActionResult MemberMenu(int pageType)
        {
            ViewData["pageType"] = pageType;
            ViewData["UserType"] = ((int)UserInfo.CurrentUser.UserType).ToString();
               
            return PartialView();
        }
        public ActionResult SellIndex()
        {
            CheckUser();
            ViewData["UserType"] = ((int)UserInfo.CurrentUser.UserType).ToString();
            return View();

        }
        public ActionResult deliver_address()
        {

            return View();
        }
        public ActionResult deliver_addresslist()
        {

            return View();
        }
        
    }
}
